package org.jtb.mensawotd;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class WidgetClickReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		int id = intent.getIntExtra("org.jtb.mensawotd.id", -1);
		Log.d("mensawotd", "click receiver, id: " + id);
		if (id == -1) {
			return;
		}
		if (intent.getAction().equals("update")) {
			// update only
			MensaWotdWidget.sendUpdateWidget(context, id);
		} else if (intent.getAction().equals("details")) {
			// details and update
			MensaWotdWidget.sendUpdateWidget(context, id);
			MensaWotdWidget.startDetails(context);
		}
	}

}
